import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import element from 'element-ui'
import axios from 'axios'
import 'element-ui/lib/theme-chalk/index.css'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/swiper-bundle.css'
// import * as echarts from 'echarts'; 
import GoEasy from "goeasy";
import IMService from "./assets/lib/imservice";


// Vue.prototype.$echarts=echarts
Vue.config.productionTip = false
Vue.use(element)
Vue.use(VueAwesomeSwiper)
Vue.prototype.$axios = axios

 axios.defaults.baseURL = 'http://localhost:8088'
// axios.defaults.baseURL = 'http://1.117.173.206:8082'
axios.interceptors.request.use(config => {
    config.headers.token = localStorage.getItem('token')
    return config
  })

Vue.filter('dataFomart',function(date){
  let dt = new Date(date);//实例化时间对象
  let y = dt.getFullYear();
 let m = dt.getMonth() + 1;
 let d = dt.getDate();
 //笨方法  return y + '-' + m + '-' + d
 //官方方法  注意引号，是tab键上面的符号（ES6的语法）
 return `${y}-${m}-${d}`
})


const goEasy = GoEasy.getInstance({
  host:'hangzhou.goeasy.io',//应用所在的区域地址: [hangzhou.goeasy.io, 新加坡暂不支持IM，敬请期待]
  appkey: 'BC-c22bd3ed39b84bf4910552308955ebe6',// common key
  modules:["im"]
});

Vue.prototype.GoEasy = GoEasy;
Vue.prototype.goEasy = goEasy;
Vue.prototype.service = new IMService(goEasy,GoEasy);

Vue.prototype.formatDate = function (t) {
  t = t || Date.now();
  let time = new Date(t);
  let str = time.getMonth() < 9 ? ('0' + (time.getMonth() + 1)) : (time.getMonth() + 1);
  str += '-';
  str += time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate();
  str += ' ';
  str += time.getHours();
  str += ':';
  str += time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes();
  return str;
};




new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
